package com.biz.primus.homepage.vo;


import com.biz.primus.base.enums.CommonStatus;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by jiangnan on 2017/7/12.
 */
@Data
public class CoverRoVo implements Serializable{

    /**
     * Id
     */
    private String id;

    /**
     * 名称
     */
    private String name;

    /**
     * 描述
     */
    private String description;

    /**
     * 排序，index大的优先显示
     */
    private Integer index = 0;

    /**
     * 状态
     */
    private CommonStatus status = CommonStatus.DISABLE;

    /**
     * 模板url(优先于模板)
     */
    private String url;

    /**
     * 模板(与模板url互斥)
     */
    private String template;

    @NotNull
    private Date startTime;

    @NotNull
    private Date endTime;


    /**
     * 模板 用户标识
     * @see com.biz.primus.homepage.enums.CoverClientType
     */
    private Integer coverClientType;

    public boolean atTheRightTime() {
        long currentTimeMillis = System.currentTimeMillis();
        return startTime != null && endTime != null && currentTimeMillis >= startTime.getTime() && System.currentTimeMillis() <= endTime.getTime();
    }
}
